<template>
  <div>
    <myheader />
    <van-field
      v-model="form.name"
      name="name"
      label="名称"
      placeholder="名称"
      :rules="[{ required: true, message: '请填写名称' }]"
    />
    <van-field
      v-model="form.types"
      name="types"
      label="等级"
      placeholder="等级"
      :rules="[{ required: true, message: '请填写等级' }]"
    />
    <van-field
      v-model="form.params"
      name="params"
      label="参数配置"
      placeholder="参数配置"
    />
    <van-button
      round
      block
      type="info"
      name="button1"
      native-type="submit"
      @click="add"
      id="button1"
      >登录</van-button
    >
  </div>
</template>

<script>
import myheader from "./myheader.vue";
export default {
  data() {
    return {
      form: { parent: 0 },
    };
  },
  methods: {
    add() {
      this.$axios.post("/course/add_cate", this.form).then((res) => {
        if (res.data.code == 200) {
          alert("添加成功")
          this.form = {}
        }
      });
    },
  },
  components: {
    myheader: myheader,
  },
};
</script>

<style scoped>
</style>